package cn.jiyun.dao;

import cn.jiyun.pojo.CheckGroup;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CheckGroupDao {
    Page<CheckGroup> findList(String queryString);

    void add(CheckGroup checkGroup);

    @Insert("INSERT INTO `health`.`t_checkgroup_checkitem`(`checkgroup_id`, `checkitem_id`) VALUES (#{gid}, #{cid})")
    void addGI(@Param("cid") Integer checkitemId, @Param("gid") Integer id);

    @Select("select checkitem_id from t_checkgroup_checkitem where checkgroup_id=#{id}")
    List<Integer> findCheckItemIdsByGid(Integer id);

    void edit(CheckGroup checkGroup);

    @Delete("delete from t_checkgroup_checkitem where checkgroup_id=#{id}")
    void delGIByGid(Integer id);

    @Select("select * from t_checkgroup")
    List<CheckGroup> finAll();
}
